package com.edou.reservation.controller.wechat;

import com.edou.base.controller.BaseController;
import com.edou.reservation.form.ReservationInfoForm;
import com.edou.reservation.service.IReservationInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 * 会员帐号模块
 *
 * @version 1.0
 * @creator admin
 * @create-time 2016/3/12 16:10:22
 * @email admin@edou.com
 * @company www.edou.com
 */
@Controller("reservationInfoWechatController")
@Scope("prototype")
@RequestMapping("/wx")
public class ReservationInfoWechatController extends BaseController {

	@Autowired
	private IReservationInfoService reservationInfoService;

	/**
	 * 新增预约信息
	 *
	 * @return
	 */
	@RequestMapping(value = "/add.htm", method = RequestMethod.POST)
	public ModelAndView add(@RequestBody ReservationInfoForm model, HttpServletRequest request, HttpServletResponse response, HttpSession session) {
		try {
			reservationInfoService.add(model.getItem());
			return ajaxJSON(Status.success, "true");
		}catch (Exception e){
			return ajaxJSON(Status.error,e.getMessage());
		}
	}

}